import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '主键',
    align: 'left',
    dataIndex: 'id',
    ifShow: false,
  },
  {
    title: '指标类型',
    align: 'left',
    dataIndex: 'indexTypeName',
  },
  {
    title: '描述',
    align: 'left',
    dataIndex: 'remark',
  },
  {
    title: '排序',
    align: 'left',
    dataIndex: 'displayOrder',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    field: 'orgCode',
    component: 'Select',
    label: '班组',
  },
  {
    field: 'indexTypeName',
    label: '指标类型',
    component: 'Input',
    colProps: { span: 8 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '组织编码',
    field: 'orgCode',
    component: 'Input',
    show: false,
  },
  {
    label: '组织名称',
    field: 'orgName',
    component: 'Input',
    required: true,
    dynamicDisabled: () => {
      return true;
    },
  },
  {
    label: '指标类型',
    field: 'indexTypeName',
    component: 'Input',
    required: true,
  },
  {
    label: '描述',
    field: 'remark',
    component: 'InputTextArea',
    componentProps: {
      maxlength: 50,
      showCount: true,
    },
  },
  {
    label: '显示排序',
    field: 'displayOrder',
    component: 'InputNumber',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
//表单数据2
export const formSchemaBase: FormSchema[] = [
  {
    label: '组织编码',
    field: 'orgCode',
    component: 'Input',
    show: false,
  },
  {
    label: '组织名称',
    field: 'orgName',
    component: 'Input',
    required: true,
    dynamicDisabled: () => {
      return true;
    },
  },
  {
    label: '上级指标类型',
    field: 'parentName',
    component: 'Input',
    required: true,
    dynamicDisabled: () => {
      return true;
    },
  },
  {
    label: '上级指标类型编码',
    field: 'parentTypeCode',
    component: 'Input',
    required: true,
    show: false,
  },
  {
    label: '指标类型',
    field: 'indexTypeName',
    component: 'Input',
    required: true,
  },
  {
    label: '描述',
    field: 'remark',
    component: 'InputTextArea',
    componentProps: {
      maxlength: 50,
      showCount: true,
    },
  },
  {
    label: '显示排序',
    field: 'displayOrder',
    component: 'InputNumber',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
